﻿using Resn.WhuPub.BLL;
using Resn.WhuPub.DAL;
using Resn.WhuPub.DML;

namespace Resn.WhuPub.BLL
{
        /// <summary>
        /// 实现专业的属性和方法
        /// </summary>
        public class Major :Entity<MajorModel>
        {
                #region 构造函数
                /// <summary>
                /// Initializes a new instance of the <see cref="Major"/> class.
                /// </summary>
                /// <param name="model">The model.</param>
                public Major(MajorModel model)
                        : base(model)
                {
                }
                #endregion
                #region 属性

                #region 基本属性

               

                /// <summary>
                /// 获取专业所属学科标识
                /// </summary>
                /// <value>
                /// 学科标识
                /// </value>
                public string SubjectId
                {
                        get
                        {
                                return Model.SubjectId;
                        }
                }

                /// <summary>
                /// 获取或设置专业名称
                /// </summary>
                /// <value>
                /// 专业名称
                /// </value>
                public string Name
                {
                        get
                        {
                                return Model.Name;
                        }
                        set
                        {
                                Model.Name = value;
                        }
                }

                /// <summary>
                /// 获取专业的代码
                /// </summary>
                /// <value>
                /// 专业的代码
                /// </value>
                public string Code
                {
                        get
                        {
                                return Model.Code;
                        }
                        set
                        {
                                Model.Code = value;
                        }
                }

                #endregion 基本属性

                

                /// <summary>
                /// 获取该专业所属的科目
                /// </summary>
                /// <value>
                /// 该专业所属的科目
                /// </value>
                public Subject Subject
                {
                        get
                        {
                                var model = DBStorage.Instance.Select<SubjectModel>(SubjectId);
                                return new Subject(model);
                        }
                }

                #endregion 属性

                #region 方法

                /// <summary>
                /// 获取指定标识的对象
                /// </summary>
                /// <param name="id">标识</param>
                /// <returns></returns>
                public static Major Select(string id)
                {
                        return Select<Major>(id);
                }

                #endregion

        }
}